Repository navigation
Stop drop! from running VACUUM, which renumbered rowids and failed in transactions - #378
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
VACUUM rebuilds the whole database. It renumbered the rowids of every table without an INTEGER PRIMARY KEY, and SQLite refuses it inside a transaction, so drop! failed there and rolled back the drop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #378 +/- ##
==========================================
- Coverage 96.81% 96.79% -0.02%
==========================================
Files 5 5
Lines 785 781 -4
==========================================
- Hits 760 756 -4
Misses 25 25 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
SQLite.drop!ranVACUUMafter every drop. That had two effects users don't expect from dropping one table:INTEGER PRIMARY KEY. A table with rowids3, 4(after deleting rows 1 and 2) came back as1, 2, so any rowid an application had stored now pointed at a different row.VACUUMinside a transaction.drop!insideDBInterface.transactionalways threwcannot VACUUM from within a transaction, and the transaction rolled back the drop.What changed
drop!only drops the table. Its docstring says to runVACUUMyourself to reclaim the space, and warns about the rowid effect.Scope
drop!. Users who relied on that can runDBInterface.execute(db, "VACUUM").dropindex!,createindex!, andremoveduplicates!don't vacuum and are unchanged.Blast Radius
Every
drop!call. It is faster on large databases (no full rebuild) and leaves other tables untouched. The return value is still theDROPstatus code.Verification
drop! keeps other rowids and works in a transaction. On master it fails with(rowid = [1, 2], ...) == (rowid = [2, 3], ...)andSQLiteException("cannot VACUUM from within a transaction"); on this branch it passes 2/2.Pkg.test()passes on Julia 1.12 (525/525) and 1.10.drop!. The existing "cannot drop a table locked by a statement" tests still throw, because theDROPitself fails there, not theVACUUM.🤖 Generated with Claude Code